Skip to content

Preserve new snippet drafts when creation fails - #669

Merged
hackjutsu merged 2 commits into
masterfrom
codex/issue-414-local-draft
Sep 6, 2026
Merged

Preserve new snippet drafts when creation fails#669
hackjutsu merged 2 commits into
masterfrom
codex/issue-414-local-draft

Conversation

@hackjutsu

@hackjutsu hackjutsu commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • save each submitted new snippet as a per-user local draft before the GitHub request
  • keep saved drafts separate from the fresh New Snippet editor instead of silently restoring them
  • show the draft creation timestamp with explicit Load draft and Drop draft actions
  • warn in the editor footer that submitting without loading the draft will discard it
  • keep the editor open on request failure and clear the draft only after successful creation
  • explain recovery in localized notifications and UI copy

User experience

When a saved draft exists, users continue to see the normal fresh editor. They can load the local draft explicitly or drop it. Loading restores its description, privacy setting, filenames, and contents. Submitting different content replaces the old local draft; a successful GitHub creation clears it.

Draft available

New Snippet editor showing a timestamped local draft with Load and Drop actions

Draft loaded

New Snippet editor after loading the saved local draft

Testing

  • npm run lint
  • npm run test:unit (216 tests)
  • npm run test:smoke (Electron app launch plus authenticated render fixtures)
  • dedicated new-draft fixture verifies fresh content, timestamped callout, footer warning, Load, and Drop behavior

Live GitHub Gist creation was not exercised against a real account; failure and recovery behavior is covered by focused unit tests and the Electron fixture flow.

Closes #414

@hackjutsu
hackjutsu merged commit b4b1daa into master Sep 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

when sync failed , file will missing

1 participant